package com.baidu.elinkagescroll.view;

import com.baidu.elinkagescroll.ChildLinkageEvent;
import com.baidu.elinkagescroll.ILinkageScroll;
import com.baidu.elinkagescroll.LinkageScrollHandler;
import com.baidu.elinkagescroll.LinkageScrollHandlerAdapter;

import ohos.agp.components.AttrSet;
import ohos.agp.components.Text;
import ohos.app.Context;

/**
 * description :
 *
 * @since 2021/7/12
 */
public class LText extends Text implements ILinkageScroll {
    /**
     * init LText
     *
     * @param context context
     */
    public LText(Context context) {
        this(context, null);
    }

    /**
     * init LText
     *
     * @param context context
     * @param attrSet attrSet
     */
    public LText(Context context, AttrSet attrSet) {
        this(context, attrSet, null);
    }

    /**
     * init LText
     *
     * @param context context
     * @param attrSet attrSet
     * @param styleName styleName
     */
    public LText(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
    }

    @Override
    public void setChildLinkageEvent(ChildLinkageEvent event) {

    }

    @Override
    public LinkageScrollHandler provideScrollHandler() {
        return new LinkageScrollHandlerAdapter() {
            @Override
            public boolean isScrollable() {
                return false;
            }

            @Override
            public int getVerticalScrollExtent() {
                return getHeight();
            }

            @Override
            public int getVerticalScrollOffset() {
                return 0;
            }

            @Override
            public int getVerticalScrollRange() {
                return getHeight();
            }
        };
    }
}
